//
//  WatchDetailUpHalfView.m
//  Blank
//
//  Created by whg－54 on 15/9/28.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "WatchDetailUpHalfView.h"
#import <Masonry.h>
#import "BrandDisplayModel.h"
#import <UIImageView+WebCache.h>
@interface WatchDetailUpHalfView ()
@property (nonatomic , strong)UILabel *brandLabel;
@property (nonatomic , strong)UILabel *discribeLabel;
@property (nonatomic , strong)UIImageView *logoView;
@property (nonatomic , strong)UIImageView *picView;
@end
@implementation WatchDetailUpHalfView
#pragma mark - 重写初始化方法
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.brandLabel = [[UILabel alloc]init];
        self.discribeLabel = [[UILabel alloc]init];
        self.logoView = [[UIImageView alloc]init];
        self.picView  = [[UIImageView alloc]init];
        
        [self addSubview:self.brandLabel];
        [self addSubview:self.discribeLabel];
        [self addSubview:self.logoView];
        [self addSubview:self.picView];
    }
    return self;
    
}
#pragma mark - 重写model类set方法
- (void) setModel:(BrandDisplayModel *)model
{
    self.brandLabel.text = model.title;
    self.discribeLabel.text = model.model;
    [self.picView sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:[UIImage imageNamed:@"zhanwei"]];
    [self.logoView sd_setImageWithURL:[NSURL URLWithString:model.brand_logo] placeholderImage:[UIImage imageNamed:@"zhanwei"]];
    
}


#pragma mark - 布局控件
- (void) layoutSubviews
{
    /**
     *  大图片
     */
    //self.picView.backgroundColor = [UIColor redColor];
    [self.picView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self).with.insets(UIEdgeInsetsMake(5*Height, 97.5*Windth, (self.frame.size.height - 245*Height), 97.5*Windth));
    }];
    
    /**
     *  品牌名
     */
    self.brandLabel.font = [UIFont systemFontOfSize:15];
    self.brandLabel.textAlignment = 1;
    //self.brandLabel.backgroundColor = [UIColor yellowColor];
    [self.brandLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self).with.insets(UIEdgeInsetsMake(245*Height, 0, 25.5*Height, 0));
    }];
    
    /**
     *  品牌描述
     */
    self.discribeLabel.textAlignment = 1;
    self.discribeLabel.textColor = [UIColor grayColor];
    self.discribeLabel.font = [UIFont systemFontOfSize:13];
    
    //self.discribeLabel.backgroundColor = [UIColor blueColor];
    [self.discribeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self).with.insets(UIEdgeInsetsMake(270.5*Height, 0, 0, 0));
    }];
    
    /**
     *  品牌logo
     */
    //self.logoView.backgroundColor = [UIColor orangeColor];
    [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self).with.insets(UIEdgeInsetsMake(0, 290*Windth, 245*Height, 10*Windth));

    }];
    
    
    
    
}



@end
